home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 001a / autonan.zip / NANET.SLT < prev   
Text File  |  1991-09-12  |  4KB  |  165 lines

  1. str user_name[] =     "Haig Zone";          // Your name
  2. str door_cmd[]  =     "QMAIL4R PROMPTS";    // Command to open door
  3. str dial_entries[] =  "2 3 4";              // Entries to dial
  4. str capture_name[] =  "CRS.CAP";            // Capture file name
  5. str reply_name[] =    "CRS.REP";            // Reply file name
  6. //////////////////////////////////////////////////////////////////////////////
  7. int errcode;
  8.  
  9. main ()
  10.  
  11. {
  12.  errcode = 0;
  13.  if (!dial (dial_entries,10,0))
  14.   exittelix (1,1);
  15.  if (fexist (capture_name))
  16.   fdelete (capture_name);
  17.  capture (capture_name);
  18.  logon();
  19.  gettodoor();
  20.  if (fexist (reply_name))
  21.   sendreplies();
  22.  getnew();
  23.  exittelix (errcode,0);
  24. }
  25.  
  26. logon() // PCBOARD.SLT included with Telix 
  27.  
  28. {
  29.  int stat;
  30.  int t1,t2,t3,t4;
  31.  int tmark;
  32.  
  33.  if (not _entry_pass)                     // no pass, so didn't recog. board
  34.   {
  35.    prints ("Sorry, I don't know the password for this BBS!");
  36.    return;
  37.   }
  38.  
  39.  t1 = track (" graphics", 1);
  40.  t2 = track ("first name?", 1);
  41.  t3 = track ("Password", 1);
  42.  t4 = track ("Language # to use", 1);
  43.  
  44.  tmark = timer_start (1800);            // wait up to 3 minutes for login
  45.  
  46.                                         // answer any logon questions
  47.  while (not time_up (tmark))
  48.   {
  49.    terminal();                          // let Telix process any chars and keys
  50.  
  51.    stat = track_hit (0);                // see which (if any) track was hit
  52.  
  53.    if (stat == t1)                      // say whether we want graphics
  54.     {
  55.      delay (5);
  56.      cputs ("y q^M");
  57.     }
  58.    else if (stat == t2)                 // send name
  59.     {
  60.      cputs (user_name);
  61.      cputs ("^M");
  62.     }
  63.    else if (stat == t3)                 // send password
  64.     {
  65.      cputs (_entry_pass);
  66.      cputs ("^M");
  67.      break;                             // done with logon
  68.     }
  69.    else if (stat == t4)                 // specific to CRS
  70.     {
  71.      delay (5);
  72.      cputs ("3^M");
  73.     }
  74.   }
  75.  
  76.  if (time_up (tmark))
  77.   prints ("Logon failed!");
  78.  
  79.  timer_free (tmark);                    // free timer channel
  80.  track_free (0);                        // and all track channels
  81.                
  82. }              
  83.  
  84. gettodoor()
  85.  
  86. {
  87.  int stat;
  88.  int t1,t2,t3;
  89.  
  90.  t1 = track ("(H)elp, More?",0);
  91.  t2 = track ("(Enter)=yes?",0);
  92.  t3 = track ("Command?",0);
  93.  
  94.  while (carrier())
  95.   {
  96.    terminal();                          // let Telix process any chars and keys
  97.  
  98.    stat = track_hit (0);                // see which (if any) track was hit
  99.  
  100.    if (stat == t1 || stat == t2)
  101.     cputs ("N^M");
  102.  
  103.    else if (stat == t3)
  104.     {
  105.      cputs (door_cmd);
  106.      cputs ("^M");
  107.      break;
  108.     }
  109.   }
  110.  
  111.  track_free (0);                        // and all track channels
  112. }
  113.  
  114. sendreplies()
  115. {
  116.  if (waitfor ("<COMMAND>",180)) {
  117.   cputs ("U^M");
  118.   if (waitfor ("<UPLOAD>",60)) {
  119.    if (send ('Z',reply_name)) {
  120.     fdelete (reply_name);
  121.     return 1;
  122.    }
  123.   }
  124.  }
  125.  errcode = errcode + 2;
  126.  return 0;
  127. }
  128.  
  129. getnew()
  130. {
  131.  int old_auto;
  132.  int tmark;
  133.  
  134.  old_auto = _zmod_auto;
  135.  _zmod_auto = 0;
  136.  
  137.  if (waitfor ("<COMMAND>",180)) {
  138.   cputs ("D;Y;G^M");
  139.   if (waitfor ("<DOWNLOAD>",600)) {
  140.    if (receive('Z',"")) {
  141.     _zmod_auto = old_auto;
  142.     tmark = timer_start (6000);
  143.     while ((not time_up(tmark)) and carrier())
  144.      {
  145.       terminal();
  146.      }
  147.     timer_free (tmark);
  148.     return 1;
  149.    }
  150.   }
  151.  }
  152.  errcode = errcode + 4;
  153.  return 0;
  154. }
  155.  
  156. fexist (str name)
  157.  
  158. {
  159.  int handle;
  160.  
  161.  handle = fopen (name,"r");
  162.  if (handle == 0) return 0;
  163.  fclose (handle);
  164.  return 1;
  165. }